{extend name="public:base" /}

{block name="style"}
<link rel="stylesheet" type="text/css" href="__INDEX__/css/public.css">
<link rel="stylesheet" type="text/css" href="__INDEX__/css/style.css">
<link rel="stylesheet" type="text/css" href="__INDEX__/css/responsive.css">
<link rel="shortcut icon" href="__INDEX__/images/favorite.ico">
<link rel="stylesheet" type="text/css" href="__COMMON__/css/style.css">
{/block}

{block name="html"}
{include file="index@public/main" /}
<div class="right_style">
    <h3 class="title_style"><em></em><span>我的提现</span></h3>
        <div class="tixian">
            <!-- <h1 class="h1">奖金积分出售</h1> -->

            <select name="bank" id="bank">
                <option value="">--请选择开户行--</option>
                {volist name="list" id="li"}
                <option value="{$li['id']}">{$li['bank']}</option>
                {/volist}
            </select>
            <input type="number" name="money" id="money" placeholder="输入提现金额" />
			<input type="Password" name="cash_paw" id="cash_paw" placeholder="资金密码" />


            <input type="hidden" name="cash" id="cash" value="{$cash.money}"/>
            <input type="hidden" name="double" id="double" value="{$double.double}"/>

            <input type="button" value="提交" id="submitCash"/>
            <p>温馨提示：提现 T+3到账 节假日顺延，注意查收</p>
        </div>
</div>
{/block}

{block name="javascript"}
<script src="__INDEX__/js/jquery-1.9.1.min.js"></script>
<script src="__INDEX__/js/public.js"></script>
<script src="__INDEX__/layer/layer.js"></script>
<script src="__COMMON__/js/area.js"></script>
<script src="__COMMON__/js/select.js"></script>
<script type="text/javascript">

    $("#submitCash").click(function(){
        var bank = $("#bank").val();
        var money = $("#money").val();
        var cash = $("#cash").val();
        var double = $("#double").val();
        var cash_paw = $("#cash_paw").val();

        if(bank == ''){
            layer_alert("请选择银行卡");
            return false;
        }
        if(money == ''){
            layer_alert("请输入提现金额");
            return false;
        }
        if( cash_paw == ''){
            layer_alert("请输入资金密码");
            return false;
        }

        $.ajax({
            type: 'POST',
            url: '{:url("Deposit/cash")}',
            dataType: 'json',
            data: {
                bank: bank,
                money: money,
                cash_paw:cash_paw
            },
            success: function (data) {

                if( data.result == 0 ){
                    layer_alert(data.msg);
                    window.location.href='{:url("Deposit/tixian_record")}';

                }else if(data == 1044){
                    layer_alert("请取"+double+"整数倍");

                }else if(data == 1057){
                    layer_alert("余额不足，无法提现");

                }else{
                    layer_alert(data.msg);
                }
            }
        });
    })
    function layer_alert(src){
        layer.open({
            content: src
            ,style: 'color:#fff;background-color:#da7276; border:none;'
            ,time: 2000 //2秒后自动关闭
        });
    }
</script>

{/block}



